﻿using System;
using System.Collections.Generic;
using System.Linq;

using SharedGenomics.Core;

namespace SharedGenomics.Workbench.Annotations
{
    public class NotificationAnnotationRequestStage : IAnnotationRequestStage
    {
        private readonly IAnnotationRequestStatusNotifier _notifier;

        public NotificationAnnotationRequestStage(IAnnotationRequestStatusNotifier notifier)
        {
            this._notifier = notifier;
        }

        public void Process(AnnotationRequestContext context, IAnnotationRequestPipelineTraversalStrategy traversalStrategy)
        {
            context.Results.ForEach(result => this._notifier.RequestCompleted(result));
            traversalStrategy.MoveNext(context);
        }
    }
}
